﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FourPartHarmony3 {
    class TimeTickInfo {
        public const int EIGHTH_NOTE_TICK = 1;

        public static int DurationToTick(DurationType t) {
            switch (t) {
            case DurationType.Whole: return 8;
            case DurationType.Half: return 4;
            case DurationType.Quarter: return 2;
            case DurationType.Eighth: return 1;
            default:
                System.Diagnostics.Debug.Assert(false);
                return 1;
            }
        }

        public static int TimeTickToBarNumber(MeterStruct meter, int timeTick) {
            return timeTick * meter.measure / meter.length / 8;
        }
    }
}
